package com.ellricky.baselib.adapter.course

import android.app.Activity
import android.view.View
import com.andr.common.ui.adapter.BaseRecyclerAdapter
import com.andr.common.ui.adapter.SmartViewHolder
import com.ellricky.baselib.R
import com.ellricky.baselib.entity.new.JobTraining
import com.ellricky.baselib.util.EAppUtil

class JobTrainingAdapter(private val context: Activity) :
    BaseRecyclerAdapter<JobTraining>(R.layout.base_adapter_job_training) {

    override fun onBindViewHolder(vh: SmartViewHolder, data: JobTraining, position: Int) {
        vh.text(R.id.tv_title, data.title)
            .text(R.id.tv_content, data.content)
            .text(R.id.tv_pdf_size, data.pdf_file_size)
            .text(R.id.tv_video_size, data.video_file_size)
            .text(R.id.tv_time, data.time)

        vh.itemView.findViewById<View>(R.id.viewVideo).setOnClickListener {
            EAppUtil.startFileViewerPage(context, data.video_file)
        }
        vh.itemView.findViewById<View>(R.id.viewPdf).setOnClickListener {
            EAppUtil.startFileViewerPage(context, data.pdf_file)
        }
    }
}